\(\int (a+b \log (c x^n))^2 \, dx\) [53]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 43 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=-2 a b n x+2 b^2 n^2 x-2 b^2 n x \log \left (c x^n\right )+x \left (a+b \log \left (c x^n\right )\right )^2 \]

[Out]

-2*a*b*n*x+2*b^2*n^2*x-2*b^2*n*x*ln(c*x^n)+x*(a+b*ln(c*x^n))^2

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {2333, 2332} \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=x \left (a+b \log \left (c x^n\right )\right )^2-2 a b n x-2 b^2 n x \log \left (c x^n\right )+2 b^2 n^2 x \]

[In]

Int[(a + b*Log[c*x^n])^2,x]

[Out]

-2*a*b*n*x + 2*b^2*n^2*x - 2*b^2*n*x*Log[c*x^n] + x*(a + b*Log[c*x^n])^2

Rule 2332

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 2333

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.), x_Symbol] :> Simp[x*(a + b*Log[c*x^n])^p, x] - Dist[b*n*p, In
t[(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, n}, x] && GtQ[p, 0] && IntegerQ[2*p]

Rubi steps \begin{align*} \text {integral}& = x \left (a+b \log \left (c x^n\right )\right )^2-(2 b n) \int \left (a+b \log \left (c x^n\right )\right ) \, dx \\ & = -2 a b n x+x \left (a+b \log \left (c x^n\right )\right )^2-\left (2 b^2 n\right ) \int \log \left (c x^n\right ) \, dx \\ & = -2 a b n x+2 b^2 n^2 x-2 b^2 n x \log \left (c x^n\right )+x \left (a+b \log \left (c x^n\right )\right )^2 \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 33, normalized size of antiderivative = 0.77 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=x \left (\left (a+b \log \left (c x^n\right )\right )^2-2 b n \left (a-b n+b \log \left (c x^n\right )\right )\right ) \]

[In]

Integrate[(a + b*Log[c*x^n])^2,x]

[Out]

x*((a + b*Log[c*x^n])^2 - 2*b*n*(a - b*n + b*Log[c*x^n]))

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.33

method result size
norman \(\left (2 b^{2} n^{2}-2 a b n +a^{2}\right ) x +b^{2} x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )^{2}+\left (-2 b^{2} n +2 a b \right ) x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )\) \(57\)
parallelrisch \(x \,b^{2} \ln \left (c \,x^{n}\right )^{2}-2 b^{2} n x \ln \left (c \,x^{n}\right )+2 b^{2} n^{2} x +2 x a b \ln \left (c \,x^{n}\right )-2 a b n x +a^{2} x\) \(59\)
default \(a^{2} x +b^{2} x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )^{2}+2 b^{2} n^{2} x -2 b^{2} n x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )+2 x a b \ln \left (c \,x^{n}\right )-2 a b n x\) \(63\)
parts \(a^{2} x +b^{2} x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )^{2}+2 b^{2} n^{2} x -2 b^{2} n x \ln \left (c \,{\mathrm e}^{n \ln \left (x \right )}\right )+2 x a b \ln \left (c \,x^{n}\right )-2 a b n x\) \(63\)
risch \(b^{2} x \ln \left (x^{n}\right )^{2}+x b \left (-i b \pi \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )+i b \pi \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}+2 b \ln \left (c \right )-2 b n +2 a \right ) \ln \left (x^{n}\right )+\frac {x \left (4 a^{2}+4 i \pi \,b^{2} n \operatorname {csgn}\left (i c \,x^{n}\right )^{3}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 i \pi a b \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-\pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \pi \,b^{2} n \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )-4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )-4 i \pi a b \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{5}-\pi ^{2} b^{2} \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{5}-\pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+8 b^{2} n^{2}+8 \ln \left (c \right ) a b +4 \ln \left (c \right )^{2} b^{2}-8 b^{2} \ln \left (c \right ) n -8 a b n -\pi ^{2} b^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{6}+4 i \pi a b \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \pi a b \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-4 i \pi \,b^{2} n \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-4 i \pi \,b^{2} n \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}\right )}{4}\) \(684\)

[In]

int((a+b*ln(c*x^n))^2,x,method=_RETURNVERBOSE)

[Out]

(2*b^2*n^2-2*a*b*n+a^2)*x+b^2*x*ln(c*exp(n*ln(x)))^2+(-2*b^2*n+2*a*b)*x*ln(c*exp(n*ln(x)))

Fricas [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.98 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=b^{2} n^{2} x \log \left (x\right )^{2} + b^{2} x \log \left (c\right )^{2} - 2 \, {\left (b^{2} n - a b\right )} x \log \left (c\right ) + {\left (2 \, b^{2} n^{2} - 2 \, a b n + a^{2}\right )} x + 2 \, {\left (b^{2} n x \log \left (c\right ) - {\left (b^{2} n^{2} - a b n\right )} x\right )} \log \left (x\right ) \]

[In]

integrate((a+b*log(c*x^n))^2,x, algorithm="fricas")

[Out]

b^2*n^2*x*log(x)^2 + b^2*x*log(c)^2 - 2*(b^2*n - a*b)*x*log(c) + (2*b^2*n^2 - 2*a*b*n + a^2)*x + 2*(b^2*n*x*lo
g(c) - (b^2*n^2 - a*b*n)*x)*log(x)

Sympy [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.51 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=a^{2} x - 2 a b n x + 2 a b x \log {\left (c x^{n} \right )} + 2 b^{2} n^{2} x - 2 b^{2} n x \log {\left (c x^{n} \right )} + b^{2} x \log {\left (c x^{n} \right )}^{2} \]

[In]

integrate((a+b*ln(c*x**n))**2,x)

[Out]

a**2*x - 2*a*b*n*x + 2*a*b*x*log(c*x**n) + 2*b**2*n**2*x - 2*b**2*n*x*log(c*x**n) + b**2*x*log(c*x**n)**2

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.33 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=b^{2} x \log \left (c x^{n}\right )^{2} - 2 \, a b n x + 2 \, a b x \log \left (c x^{n}\right ) + 2 \, {\left (n^{2} x - n x \log \left (c x^{n}\right )\right )} b^{2} + a^{2} x \]

[In]

integrate((a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

b^2*x*log(c*x^n)^2 - 2*a*b*n*x + 2*a*b*x*log(c*x^n) + 2*(n^2*x - n*x*log(c*x^n))*b^2 + a^2*x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 88 vs. \(2 (43) = 86\).

Time = 0.36 (sec) , antiderivative size = 88, normalized size of antiderivative = 2.05 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=b^{2} n^{2} x \log \left (x\right )^{2} - 2 \, b^{2} n^{2} x \log \left (x\right ) + 2 \, b^{2} n x \log \left (c\right ) \log \left (x\right ) + 2 \, b^{2} n^{2} x - 2 \, b^{2} n x \log \left (c\right ) + b^{2} x \log \left (c\right )^{2} + 2 \, a b n x \log \left (x\right ) - 2 \, a b n x + 2 \, a b x \log \left (c\right ) + a^{2} x \]

[In]

integrate((a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

b^2*n^2*x*log(x)^2 - 2*b^2*n^2*x*log(x) + 2*b^2*n*x*log(c)*log(x) + 2*b^2*n^2*x - 2*b^2*n*x*log(c) + b^2*x*log
(c)^2 + 2*a*b*n*x*log(x) - 2*a*b*n*x + 2*a*b*x*log(c) + a^2*x

Mupad [B] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.14 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \, dx=x\,\left (a^2-2\,a\,b\,n+2\,b^2\,n^2\right )+b^2\,x\,{\ln \left (c\,x^n\right )}^2+2\,b\,x\,\ln \left (c\,x^n\right )\,\left (a-b\,n\right ) \]

[In]

int((a + b*log(c*x^n))^2,x)

[Out]

x*(a^2 + 2*b^2*n^2 - 2*a*b*n) + b^2*x*log(c*x^n)^2 + 2*b*x*log(c*x^n)*(a - b*n)